package sim_moteur.factory;

import util.RandomSansRepetition;
import util.Sequence;
import util.SequencePredeterminee;
import util.SimProperties;

public class SequenceFactory implements Factory<Sequence> {

	private SimProperties properties = SimProperties.getInstance();
	private static SequenceFactory instance = new SequenceFactory();
	private boolean estPredeterminee = false;
	
	@Override
	public Sequence get() {
		Sequence retSequence;
		if(estPredeterminee){
			retSequence = new SequencePredeterminee();
		} else{
			retSequence = new RandomSansRepetition(8);
		}
		return retSequence;
	}
	
	public SequenceFactory(){
		String type = properties.getStringProperty("simulation.sequence.type");
		if(type.equals("predeterminee")){
			estPredeterminee = true;
		}
	}
	
	public static SequenceFactory getFactory(){
		return instance;
	}

}
